import Book.BookList;
import user.AdmireUser;
import user.NormalUser;
import user.User;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86184
 * Date: 2023-02-18
 * Time: 15:15
 */
public class Main {
    public static User login() {
        System.out.println("请输入你的名字");
        Scanner scanner = new Scanner(System.in);
        String userName = scanner.nextLine();
        System.out.println("请输入你的身份---》管理员：1 普通用户---》0 ");
        int choice = scanner.nextInt();
        if (choice == 1) {
            return new AdmireUser(userName);
        } else {
            return new NormalUser(userName);
        }
    }

    public static void main(String[] args) {
        //0.准备数据
        BookList bookList = new BookList();

        //1.登录
        User user = login();
        while(true) {
            int choice = user.menu();
            user.doOperation(choice, bookList);
        }
    }
}
